package com.huaxiafinance.management.util;


import java.util.Random;


public class GiftCodeUtil
{

    /**
     * 获取随机字符串
     *
     * @return String
     */
    public static String genRandomNum()
    {
        int maxNum = 10;
        int i;
        int count = 0;
        char[] str = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9'};
        StringBuffer pwd = new StringBuffer("");
        Random r = new Random();
        while (count < 8)
        {
            i = Math.abs(r.nextInt(maxNum));
            if (i >= 0 && i < str.length)
            {
                pwd.append(str[i]);
                count++ ;
            }
        }
        return pwd.toString();
    }
}
